package com.feng.annotation;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class HelloImpl implements Hello {

	public void sayHello() {
		System.out.println("Hello java!");
	}
	public static void main(String args[]){
		Hello d = new HelloImpl(); 
		InvocationHandler handler = new HelloWorldHandler(d);
		Hello proxy = (Hello) Proxy.newProxyInstance(
			d.getClass().getClassLoader(),
			d.getClass().getInterfaces(),
			handler);
		proxy.sayHello();
	}
}
